Skip to content

Conversation

bigcat88
Copy link
Contributor

@bigcat88 bigcat88 commented Oct 4, 2025

Node ControlNetInpaintingAliMamaApply was tested after conversion:

Screenshot From 2025-10-04 17-11-22

Link to the sources of the ControlNetApplyAdvanced node that was copy-pasted into ControlNetInpaintingAliMamaApply node:

ComfyUI/nodes.py

Lines 874 to 900 in bbd6830

def apply_controlnet(self, positive, negative, control_net, image, strength, start_percent, end_percent, vae=None, extra_concat=[]):
if strength == 0:
return (positive, negative)
control_hint = image.movedim(-1,1)
cnets = {}
out = []
for conditioning in [positive, negative]:
c = []
for t in conditioning:
d = t[1].copy()
prev_cnet = d.get('control', None)
if prev_cnet in cnets:
c_net = cnets[prev_cnet]
else:
c_net = control_net.copy().set_cond_hint(control_hint, strength, (start_percent, end_percent), vae=vae, extra_concat=extra_concat)
c_net.set_previous_controlnet(prev_cnet)
cnets[prev_cnet] = c_net
d['control'] = c_net
d['control_apply_to_uncond'] = False
n = [t[0], d]
c.append(n)
out.append(c)
return (out[0], out[1])

Objects git diff:

diff --git a/v3_object_info.json b/master_object_info.json
index c3c1a2a..07c3b14 100644
--- a/v3_object_info.json
+++ b/master_object_info.json
@@ -19570,25 +19570,20 @@
         "input": {
             "required": {
                 "control_net": [
-                    "CONTROL_NET",
-                    {}
+                    "CONTROL_NET"
                 ],
                 "type": [
-                    "COMBO",
-                    {
-                        "multiselect": false,
-                        "options": [
-                            "auto",
-                            "openpose",
-                            "depth",
-                            "hed/pidi/scribble/ted",
-                            "canny/lineart/anime_lineart/mlsd",
-                            "normal",
-                            "segment",
-                            "tile",
-                            "repaint"
-                        ]
-                    }
+                    [
+                        "auto",
+                        "openpose",
+                        "depth",
+                        "hed/pidi/scribble/ted",
+                        "canny/lineart/anime_lineart/mlsd",
+                        "normal",
+                        "segment",
+                        "tile",
+                        "repaint"
+                    ]
                 ]
             }
         },
@@ -19607,45 +19602,33 @@
         "output_name": [
             "CONTROL_NET"
         ],
-        "output_tooltips": [
-            null
-        ],
         "name": "SetUnionControlNetType",
-        "display_name": null,
+        "display_name": "SetUnionControlNetType",
         "description": "",
         "python_module": "comfy_extras.nodes_controlnet",
         "category": "conditioning/controlnet",
-        "output_node": false,
-        "deprecated": false,
-        "experimental": false,
-        "api_node": false
+        "output_node": false
     },
     "ControlNetInpaintingAliMamaApply": {
         "input": {
             "required": {
                 "positive": [
-                    "CONDITIONING",
-                    {}
+                    "CONDITIONING"
                 ],
                 "negative": [
-                    "CONDITIONING",
-                    {}
+                    "CONDITIONING"
                 ],
                 "control_net": [
-                    "CONTROL_NET",
-                    {}
+                    "CONTROL_NET"
                 ],
                 "vae": [
-                    "VAE",
-                    {}
+                    "VAE"
                 ],
                 "image": [
-                    "IMAGE",
-                    {}
+                    "IMAGE"
                 ],
                 "mask": [
-                    "MASK",
-                    {}
+                    "MASK"
                 ],
                 "strength": [
                     "FLOAT",
@@ -19701,19 +19684,12 @@
             "positive",
             "negative"
         ],
-        "output_tooltips": [
-            null,
-            null
-        ],
         "name": "ControlNetInpaintingAliMamaApply",
-        "display_name": null,
+        "display_name": "ControlNetInpaintingAliMamaApply",
         "description": "",
         "python_module": "comfy_extras.nodes_controlnet",
         "category": "conditioning/controlnet",
-        "output_node": false,
-        "deprecated": false,
-        "experimental": false,
-        "api_node": false
+        "output_node": false
     },
     "CLIPTextEncodeHunyuanDiT": {
         "input": {

@bigcat88 bigcat88 requested a review from Kosinkadink as a code owner October 4, 2025 14:17
@bigcat88
Copy link
Contributor Author

bigcat88 commented Oct 4, 2025

+label: Core

@comfy-pr-bot comfy-pr-bot added the Core Core team dependency label Oct 4, 2025
@Kosinkadink
Copy link
Collaborator

To avoid code duplication, we should probably extract the contents of controlnet nodes into their own functions, and then we can reference it from all controlnet nodes. It should not break any custom nodes that are importing the nodes from nodes.py as well.

@bigcat88 bigcat88 force-pushed the v3/nodes_controlnet branch from f3bd8b5 to d0b4966 Compare October 5, 2025 05:04
@bigcat88
Copy link
Contributor Author

bigcat88 commented Oct 5, 2025

I have force pushed g the new version without duplicating or extracting code, where we simply call the old node without inheritance. What do you think of the new version?

@Kosinkadink
Copy link
Collaborator

it looks ok. the nodes inside node.py will be the last to be converted (and at an unknown time), so this should do for now. in the long term we'd probably want to extract the controlnet function and make it generalizable for 'n' amount of conditioning. i'll start sending out notices to node authors for nodes_controlnet.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Core team dependency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants